import { createRouter, createWebHistory } from 'vue-router'

// 加载配置
import menus from './routerConfig'

// 加载类型和转换工具
import type { IRouter } from './tool'
import { toRouter } from './tool'

// 路由容器
const myRoutes: IRouter[] = []
// 转换
myRoutes.push(...toRouter(menus))

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: myRoutes
})

export default router
